Fix bug in BGETC when using sockets #185
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Chris,
at the moment I'm using sockets a lot to communicate from PC with a Raspberry Pi. Works very well and is programmed fast and easy.
I realized a bug with BGETC. When sending a zero with BPUTC, the zero was interpreted as end-of-connection and EOF returned true. I fixed this.
The second inconsistency I realized was, that LOF only returns that data is waiting, but not how much data. I changed this. Now it is possible to query how much data is in the queue and use INPUT(len, file) to get all the data in one go. I hope that there are not to much basic scripts, which will make trouble now.
To test the socket communication, I added a unit test. It will only work in Linux and is a little bit tricky. Please have a look, if this is OK for you.
Best regards, Joerg